import java.util.HashMap;

public class Main {
    public static int solution(String S) {
        // PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
        // write code here
        HashMap<Character, Integer> charMap = new HashMap<>();

        for (char c : S.toCharArray()) {
            charMap.put(c, charMap.getOrDefault(c, 0) + 1);
        }

        int res = 0;

        for (int count: charMap.values()) {
            res = res + count / 2;
        }

        return res;
    }

    public static void main(String[] args) {
        System.out.println(solution("abab") == 2);
        System.out.println(solution("aaaa") == 2);
        System.out.println(solution("abcabc") == 3);
    }
}